home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / ixemul-complete / ixemul / static / private.h < prev    next >
C/C++ Source or Header  |  1996-05-08  |  5KB  |  248 lines

  1. #ifndef PRIVATE_H
  2.  
  3. #define PRIVATE_H
  4.  
  5. /*
  6. ** This header is for use ONLY with the time conversion code.
  7. ** There is no guarantee that it will remain unchanged,
  8. ** or that it will remain at all.
  9. ** Do NOT copy it to any system include directory.
  10. ** Thank you!
  11. */
  12.  
  13. /*
  14. ** ID
  15. */
  16.  
  17. #ifndef lint
  18. #ifndef NOID
  19. static char    privatehid[] = "@(#)private.h    7.42";
  20. #endif /* !defined NOID */
  21. #endif /* !defined lint */
  22.  
  23. /*
  24. ** Defaults for preprocessor symbols.
  25. ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
  26. */
  27.  
  28. #ifndef HAVE_ADJTIME
  29. #define HAVE_ADJTIME        1
  30. #endif /* !defined HAVE_ADJTIME */
  31.  
  32. #ifndef HAVE_GETTEXT
  33. #define HAVE_GETTEXT        0
  34. #endif /* !defined HAVE_GETTEXT */
  35.  
  36. #ifndef HAVE_SETTIMEOFDAY
  37. #define HAVE_SETTIMEOFDAY    3
  38. #endif /* !defined HAVE_SETTIMEOFDAY */
  39.  
  40. #ifndef HAVE_STRERROR
  41. #define HAVE_STRERROR        0
  42. #endif /* !defined HAVE_STRERROR */
  43.  
  44. #ifndef HAVE_UNISTD_H
  45. #define HAVE_UNISTD_H        1
  46. #endif /* !defined HAVE_UNISTD_H */
  47.  
  48. #ifndef HAVE_UTMPX_H
  49. #define HAVE_UTMPX_H        0
  50. #endif /* !defined HAVE_UTMPX_H */
  51.  
  52. #ifndef LOCALE_HOME
  53. #define LOCALE_HOME        "/usr/lib/locale"
  54. #endif /* !defined LOCALE_HOME */
  55.  
  56. /*
  57. ** Nested includes
  58. */
  59.  
  60. #include "sys/types.h"    /* for time_t */
  61. #include "stdio.h"
  62. #include "errno.h"
  63. #include "string.h"
  64. #include "limits.h"    /* for CHAR_BIT */
  65. #include "time.h"
  66. #include "stdlib.h"
  67.  
  68. #if HAVE_GETTEXT - 0
  69. #include "libintl.h"
  70. #endif /* HAVE_GETTEXT - 0 */
  71.  
  72. #if HAVE_UNISTD_H - 0
  73. #include "unistd.h"    /* for F_OK and R_OK */
  74. #endif /* HAVE_UNISTD_H - 0 */
  75.  
  76. #if !(HAVE_UNISTD_H - 0)
  77. #ifndef F_OK
  78. #define F_OK    0
  79. #endif /* !defined F_OK */
  80. #ifndef R_OK
  81. #define R_OK    4
  82. #endif /* !defined R_OK */
  83. #endif /* !(HAVE_UNISTD_H - 0) */
  84.  
  85. /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
  86. #define is_digit(c) ((unsigned)(c) - '0' <= 9)
  87.  
  88. /*
  89. ** Workarounds for compilers/systems.
  90. */
  91.  
  92. /*
  93. ** SunOS 4.1.1 cc lacks const.
  94. */
  95.  
  96. #ifndef const
  97. #ifndef __STDC__
  98. #define const
  99. #endif /* !defined __STDC__ */
  100. #endif /* !defined const */
  101.  
  102. /*
  103. ** SunOS 4.1.1 cc lacks prototypes.
  104. */
  105.  
  106. #ifndef P
  107. #ifdef __STDC__
  108. #define P(x)    x
  109. #endif /* defined __STDC__ */
  110. #ifndef __STDC__
  111. #define P(x)    ()
  112. #endif /* !defined __STDC__ */
  113. #endif /* !defined P */
  114.  
  115. /*
  116. ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
  117. */
  118.  
  119. #ifndef EXIT_SUCCESS
  120. #define EXIT_SUCCESS    0
  121. #endif /* !defined EXIT_SUCCESS */
  122.  
  123. /*
  124. ** SunOS 4.1.1 headers lack EXIT_FAILURE.
  125. */
  126.  
  127. #ifndef EXIT_FAILURE
  128. #define EXIT_FAILURE    1
  129. #endif /* !defined EXIT_FAILURE */
  130.  
  131. /*
  132. ** SunOS 4.1.1 headers lack FILENAME_MAX.
  133. */
  134.  
  135. #ifndef FILENAME_MAX
  136.  
  137. #ifndef MAXPATHLEN
  138. #ifdef unix
  139. #include "sys/param.h"
  140. #endif /* defined unix */
  141. #endif /* !defined MAXPATHLEN */
  142.  
  143. #ifdef MAXPATHLEN
  144. #define FILENAME_MAX    MAXPATHLEN
  145. #endif /* defined MAXPATHLEN */
  146. #ifndef MAXPATHLEN
  147. #define FILENAME_MAX    1024        /* Pure guesswork */
  148. #endif /* !defined MAXPATHLEN */
  149.  
  150. #endif /* !defined FILENAME_MAX */
  151.  
  152. /*
  153. ** SunOS 4.1.1 libraries lack remove.
  154. */
  155.  
  156. #ifndef remove
  157. extern int    unlink P((const char * filename));
  158. #define remove    unlink
  159. #endif /* !defined remove */
  160.  
  161. /*
  162. ** Some ancient errno.h implementations don't declare errno.
  163. ** But some newer errno.h implementations define it as a macro.
  164. ** Fix the former without affecting the latter.
  165. */
  166. #ifndef errno
  167. extern int errno;
  168. #endif /* !defined errno */
  169.  
  170. /*
  171. ** Finally, some convenience items.
  172. */
  173.  
  174. #ifndef TRUE
  175. #define TRUE    1
  176. #endif /* !defined TRUE */
  177.  
  178. #ifndef FALSE
  179. #define FALSE    0
  180. #endif /* !defined FALSE */
  181.  
  182. #ifndef TYPE_BIT
  183. #define TYPE_BIT(type)    (sizeof (type) * CHAR_BIT)
  184. #endif /* !defined TYPE_BIT */
  185.  
  186. #ifndef TYPE_SIGNED
  187. #define TYPE_SIGNED(type) (((type) -1) < 0)
  188. #endif /* !defined TYPE_SIGNED */
  189.  
  190. #ifndef INT_STRLEN_MAXIMUM
  191. /*
  192. ** 302 / 1000 is log10(2.0) rounded up.
  193. ** Subtract one for the sign bit if the type is signed;
  194. ** add one for integer division truncation;
  195. ** add one more for a minus sign if the type is signed.
  196. */
  197. #define INT_STRLEN_MAXIMUM(type) \
  198.     ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 100 + 1 + TYPE_SIGNED(type))
  199. #endif /* !defined INT_STRLEN_MAXIMUM */
  200.  
  201. /*
  202. ** INITIALIZE(x)
  203. */
  204.  
  205. #ifndef GNUC_or_lint
  206. #ifdef lint
  207. #define GNUC_or_lint
  208. #endif /* defined lint */
  209. #ifndef lint
  210. #ifdef __GNUC__
  211. #define GNUC_or_lint
  212. #endif /* defined __GNUC__ */
  213. #endif /* !defined lint */
  214. #endif /* !defined GNUC_or_lint */
  215.  
  216. #ifndef INITIALIZE
  217. #ifdef GNUC_or_lint
  218. #define INITIALIZE(x)    ((x) = 0)
  219. #endif /* defined GNUC_or_lint */
  220. #ifndef GNUC_or_lint
  221. #define INITIALIZE(x)
  222. #endif /* !defined GNUC_or_lint */
  223. #endif /* !defined INITIALIZE */
  224.  
  225. /*
  226. ** For the benefit of GNU folk...
  227. ** `_(MSGID)' uses the current locale's message library string for MSGID.
  228. ** The default is to use gettext if available, and use MSGID otherwise.
  229. */
  230.  
  231. #ifndef _
  232. #if HAVE_GETTEXT - 0
  233. #define _(msgid) gettext(msgid)
  234. #else /* !(HAVE_GETTEXT - 0) */
  235. #define _(msgid) msgid
  236. #endif /* !(HAVE_GETTEXT - 0) */
  237. #endif /* !defined _ */
  238.  
  239. #ifndef TZ_DOMAIN
  240. #define TZ_DOMAIN "tz"
  241. #endif /* !defined TZ_DOMAIN */
  242.  
  243. /*
  244. ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
  245. */
  246.  
  247. #endif /* !defined PRIVATE_H */
  248.